//
//  AboutUsViewController.swift
//  koolcar
//
//  Created by xiantian on 2023/11/6.
//

import UIKit

class AboutUsViewController: BaseViewController {
    var segmentView: ContactSegmentView!
    var scrollView: UIScrollView!
    
    var companyInfoView: AboutPlatformView! //公司介绍
    var companyAdView: AboutPlatformView! //公司优势
    var buyCarView: AboutPlatformView! //汽车代购
    var otherView: AboutPlatformView! //其它
    var aboutId: String = ""
    override func viewDidLoad() {
        super.viewDidLoad()
        self.navBar.title = MMLocalizedString("about_us", comment: "关于我们")
        self.navBar.wr_setBottomLineHidden(hidden: true)
        
        segmentView = ContactSegmentView.init(frame: CGRect.init(x: 0, y: NavBarHight, width: kScreenWidth, height: 54))
        segmentView.callBack = { [weak self] tag in
            UIView.animate(withDuration: 0.2) {
                self?.scrollView.contentOffset.x = kScreenWidth * CGFloat(tag)
            }
        }
        self.view.addSubview(segmentView)
        
        let tempHeight: CGFloat = kScreenHeight - segmentView.frame.maxY
        scrollView = UIScrollView.init(frame: CGRect.init(x: 0, y: segmentView.frame.maxY, width: kScreenWidth, height: tempHeight))
        scrollView.contentSize = CGSize.init(width: kScreenWidth * 4, height: tempHeight)
        scrollView.isPagingEnabled = true
        scrollView.isScrollEnabled = true
        scrollView.showsVerticalScrollIndicator = false
        scrollView.showsHorizontalScrollIndicator = false
        self.view.addSubview(scrollView)
       
        companyInfoView = AboutPlatformView.init(frame: CGRect.init(x: 0, y: 0, width: kScreenWidth, height: tempHeight))
        companyAdView = AboutPlatformView.init(frame: CGRect.init(x: kScreenWidth, y: 0, width: kScreenWidth, height: tempHeight))
        buyCarView = AboutPlatformView.init(frame: CGRect.init(x: kScreenWidth * 2, y: 0, width: kScreenWidth, height: tempHeight))
        otherView = AboutPlatformView.init(frame: CGRect.init(x: kScreenWidth * 3, y: 0, width: kScreenWidth, height: tempHeight))

        scrollView.addSubview(companyInfoView)
        scrollView.addSubview(companyAdView)
        scrollView.addSubview(buyCarView)
        scrollView.addSubview(otherView)
    }

}
